import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Random;

import javax.swing.JButton;

public abstract class RandomEvent implements ActionListener
{

	
	
		
	protected String[] responses;
	protected String imageFilename;
	protected String displayName;
	protected MainCardPanel display;
	protected Random rand;
	protected Party p;
	protected boolean fresh;
	boolean dead;
	

    public RandomEvent(MainCardPanel display, Party p){
    	this.display = display;
    	rand = new Random();
    	this.p = p;
    	fresh = true;
    	dead = false;
    }
	/**
	 * Causes the RandomEvent to get closer to ending, if applicable. 
	 * For example, a jeep might lose gas, rain might get closer to ending.
	 * This signature is designed to be used for RandomEvents held by the team.
	 */
	public void decay(){
		if (dead)
			return;
		if (fresh)
		{
			display.showRandomEventPanel(this);
		}
		fresh = false;
	}
	

	public abstract JButton[] getResponseElements();
		
	

	public String getImageFilename() {
		return imageFilename;
	}
	
	public void actionPerformed(ActionEvent e){
		display.userRespondedToRandomEvent();
		fresh = false;
	}


	public String getDisplayName() {
		return displayName;
	}
	public boolean isDead() {
		
		return dead;
	}


	
	
	
}